package com.xo.mall.controller.pms;

import com.xo.common.Result.CommonPage;
import com.xo.common.Result.ResultResponse;
import com.xo.common.pojo.dto.req.BrandCreateReqDto;
import com.xo.common.pojo.dto.req.EditBrandByIdDto;
import com.xo.common.pojo.dto.req.PageBrandListDto;
import com.xo.common.pojo.vo.BrandListVo;
import com.xo.mall.server.PmsBrandService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/mall/pms")
@Tag(name = "品牌管理")
public class PmsBrandController {

    @Resource
    private PmsBrandService pmsBrandService;

    @Operation(summary = "品牌创建", description = "品牌创建")
    @PostMapping("/brandCreate")
    public ResultResponse<Object> brandCreate(@RequestBody BrandCreateReqDto brandCreateReqDTO) {
        return pmsBrandService.brandCreate(brandCreateReqDTO);
    }

    @Operation(summary = "获取品牌列表", description = "获取品牌列表")
    @PostMapping("/brandList")
    public ResultResponse<CommonPage<BrandListVo>>  brandList(@RequestBody PageBrandListDto pageBrandListDto) {
        return pmsBrandService.brandList(pageBrandListDto);
    }

    @Operation(summary = "根据品牌id删除品牌", description = "根据品牌id删除品牌")
    @PostMapping("/deleteBrandById/{id}")
    public ResultResponse<Object> deleteBrandById(@PathVariable Integer id) {
        return pmsBrandService.deleteBrandById(id);
    }

    @Operation(summary = "编辑品牌", description = "编辑品牌")
    @PostMapping("/editBrandById")
    public ResultResponse<Object> editBrandById(@RequestBody EditBrandByIdDto editBrandByIdDto) {
        return pmsBrandService.editBrandById(editBrandByIdDto);
    }

}
